/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.apt.createAdmin;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.validator.ValidatorForm;

/**
 *
 * @author Bach
 */
//ValidatorForm
public class NewAccAdminForm extends ActionForm {

    private String username;
    private String email;
    private String pass;
    private String reemail;
    private String repass;

    public NewAccAdminForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getUsername() == null || getUsername().length() < 1) {
            errors.add("name", new ActionMessage("err.createAcAdminForm.username"));
            // TODO: add 'error.name.required' key to your resources
        } else if (getEmail() == null || getEmail().length() < 1) {
            errors.add("email", new ActionMessage("err.createAcAdminForm.email"));
            // TODO: add 'error.name.required' key to your resources
        } else if (getPass()== null || getPass().length() < 1) {
            errors.add("password", new ActionMessage("err.createAcAdminForm.pass"));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the pass
     */
    public String getPass() {
        return pass;
    }

    /**
     * @param pass the pass to set
     */
    public void setPass(String pass) {
        this.pass = pass;
    }

    /**
     * @return the reemail
     */
    public String getReemail() {
        return reemail;
    }

    /**
     * @param reemail the reemail to set
     */
    public void setReemail(String reemail) {
        this.reemail = reemail;
    }

    /**
     * @return the repass
     */
    public String getRepass() {
        return repass;
    }

    /**
     * @param repass the repass to set
     */
    public void setRepass(String repass) {
        this.repass = repass;
    }
}
